Goldman Sachs Interview Experience | Campus drive for summer internship 2021 – IIT(BHU)
The process consisted of 1 online coding round , 3  tech interview rounds and 1 HR interview round....
read more
Array of Linked Lists in C/C++
An array in C/C++ or be it in any programming language is a collection of similar data items stored at contiguous memory locations and elements that can be accessed randomly using indices of an array.  They can be used to store the collection of primitive data types such as int, float, double, char, etc of any particular type. To add to it, an array in C/C++ can store derived data types such as structures, pointers, etc. Given below is the picture representation of an array....
read more
Create a tree in level order
Given an array of elements, the task is to insert these elements in level order and construct a tree....
read more
Find maximum in a stack in O(1) time and O(1) extra space
Given a stack of integers. The task is to design a special stack such that the maximum element can be found in O(1) time and O(1) extra space....
read more
Query to find length of the longest subarray consisting only of 1s
Given a binary array arr[] of size N and a 2D array Q[][] containing K queries of the following two types:...
read more
Array Range Queries to find the Maximum Armstrong number with updates
Given an array arr[] of N integers, the task is to perform the following two queries:...
read more
Number of subarrays with GCD = 1 | Segment tree
Given an array arr[], the task is to find the count of sub-arrays with GCD equal to 1.Examples:...
read more
Find the number of different numbers in the array after applying the given operation q times
Given an array of size N, initially consists of zeroes only. The task is to apply the given operation q times and find the number of different numbers in the array except for zeroes. Operation Format: update(l, r, x):: update a[i] = x for all (l <= i <= r)....
read more
Index of kth set bit in a binary array with update queries
Given a binary array arr[] and q queries of following types:...
read more
Remove minimum elements from either side such that 2*min becomes more than max | Set 2
Given an unsorted array, trim the array such that twice of minimum is greater than the maximum in the trimmed array. Elements should be removed from either end of the array. The number of removals should be minimum....
read more
Range queries to count 1s in a subarray after flip operations
Given an array ‘arr’ all the numbers of which are initialized to ‘0’ then the array can be updated at any time in the following way: All the elements of any sub-array from the array can be flipped i.e. ‘1’ => ‘0’ or ‘0’ => ‘1’. The task is to find the number of 1s from the array for any incoming query [l, r] where ‘l’ and ‘r’ are valid indices in the given array....
read more
Count number of smallest elements in given range
Given an array of N numbers and Q queries, each query consists of L and R. We need to write a program that prints the number of occurrence of the smallest element in the range L-R....
read more